package com.jy.event.domain;

import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

/**
 * Created by hanxi on 2017/7/8.
 */
@Entity
@Data
@NoArgsConstructor
public class Member {
    @Id
    @Column(length = 50)
    private String id;
    private String code;
    private String name;
    /**
     * 平台余额
     */
    private double amount = 0;
    /**
     * 加入平台时间
     */
    @Column(columnDefinition = "TIMESTAMP(3) NULL")
    private Date enrollmentTime = new Date();

    /**
     * 平台积分
     */
    private long points = 0;
    @Column(insertable = false, updatable = false, columnDefinition = "TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3)")
    private Date addTime;
    @Column(insertable = false, updatable = false, columnDefinition = "TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)")
    private Date updateTime;
    private boolean enabled = true;
    /**
     * 微信open id
     */
    private String openId;
    private String mobile;

    /**
     * 头像
     */
    private String headImgUrl;

    /**
     * 生日
     */
    @Column(columnDefinition = "TIMESTAMP(3) NULL")
    private Date birthday;

    @OneToMany
    @JoinColumn(name = "member_id")
    private Set<MemberAccount> accounts = new HashSet<>();


}
